/*
 * Provides registration of all codecs for libavcodec.
 * Copyright (c) 2002 Fabrice Bellard.
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

/**
 * @file allcodecs.c
 * Provides registration of all codecs for libavcodec.
 */

#include "avcodec.h"
#include "config_msvc.h"

#define REGISTER_ENCODER(X,x) { \
	extern AVCodec x##_encoder; \
	if(ENABLE_##X##_ENCODER)  register_avcodec(&x##_encoder); }
#define REGISTER_DECODER(X,x) { \
	extern AVCodec x##_decoder; \
	if(ENABLE_##X##_DECODER)  register_avcodec(&x##_decoder); }
#define REGISTER_ENCDEC(X,x)  REGISTER_ENCODER(X,x); REGISTER_DECODER(X,x)

#define REGISTER_PARSER(X,x) { \
	extern AVCodecParser x##_parser; \
	if(ENABLE_##X##_PARSER)  av_register_codec_parser(&x##_parser); }
#define REGISTER_BSF(X,x) { \
	extern AVBitStreamFilter x##_bsf; \
	if(ENABLE_##X##_BSF)     av_register_bitstream_filter(&x##_bsf); }

/**
 * Register all the codecs which were enabled at configuration time. 
 * If you do not call this function you can select exactly which formats
 * you want to support, by using the individual registration functions.
 *
 * @see register_avcodec
 */
void avcodec_register_all(void)
{
    static int inited = 0;

    if (inited != 0)
        return;
    inited = 1;

	REGISTER_ENCDEC  (MPEG1VIDEO, mpeg1video);
	REGISTER_ENCODER  (MPEG2VIDEO, mpeg2video);
	REGISTER_ENCODER  (MPEG4, mpeg4);	
	REGISTER_ENCODER  (MSMPEG4V1, msmpeg4v1);
	REGISTER_ENCODER  (MSMPEG4V2, msmpeg4v2);
	REGISTER_ENCODER  (MSMPEG4V3, msmpeg4v3);
	REGISTER_PARSER  (MPEGVIDEO, mpegvideo);
	REGISTER_ENCODER  (H263, h263);
	REGISTER_ENCODER  (LIBAMR_NB, libamr_nb);	
	REGISTER_ENCODER (AC3, ac3);
	REGISTER_ENCDEC (MP2, mp2);    

	REGISTER_ENCODER (LIBFAAC, libfaac);
	REGISTER_ENCODER (LIBMP3LAME, libmp3lame);
	REGISTER_ENCODER (LIBX264, libx264);
	REGISTER_ENCODER (LIBXVID, libxvid);


	REGISTER_PARSER(MPEGAUDIO, mpegaudio);

}
